use crate::{SYS_EXIT, SYS_GETPID, SYS_KILL, SYS_SCHED_YIELD, enter_syscall};

pub fn getpid() -> usize {
    enter_syscall(0, 0, 0, 0, 0, 0, SYS_GETPID)
}

use core::hint::spin_loop;
pub fn exit(code: usize) -> ! {
    enter_syscall(code, 0, 0, 0, 0, 0, SYS_EXIT);

    loop {
        spin_loop();
    }
}

pub fn r#yield() {
    enter_syscall(0, 0, 0, 0, 0, 0, SYS_SCHED_YIELD);
}

pub fn kill(pid: usize) {
    enter_syscall(pid, 0, 0, 0, 0, 0, SYS_KILL);
}
